<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>内容管理系统</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="<?=base_url()?>style/bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="<?=base_url()?>style/dist/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="<?=base_url()?>style/dist/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="<?=base_url()?>style/dist/css/AdminLTE.min.css">
  <!-- iCheck -->
  <link rel="stylesheet" href="<?=base_url()?>style/plugins/iCheck/square/blue.css">
  <!-- 自定义样式 -->
  <link rel="stylesheet" href="<?=base_url()?>style/css/admin.css">
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <img src="<?=base_url()?>style/img/etocrm.png">
        <h4><a href="#">内容管理系统</a></h4>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <!-- <p class="login-box-msg">登录进入系统</p> -->
        <form action="<?=base_url()?>index.php/admin/Login/signin" method="post" id='LoginForm'>
            <div class="form-group has-feedback">
				<input type="email" class="form-control" placeholder="账号"
					name="user[name]" fld='name' value="<?= $user_name?>">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
				<label style="color:red;"></label>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" placeholder="密码"
					name="user[password]" fld='password'>
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
				<label style="color:red;"></label>
            </div>
            <div class="row">
            <!-- <div class="col-xs-8">
              <div class="checkbox icheck">
                <label>
                  <input type="checkbox"> 记住我
                </label>
              </div>
            </div> -->
            <!-- /.col -->
                <div class="col-xs-12">
                    <button type="button" class="btn btn-primary btn-block btn-flat bg-pink" id='submitBtn'>登录</button>
                </div>
                <!-- /.col -->
            </div>
        </form>
    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<!-- jQuery 2.2.3 -->
<script src="<?=base_url()?>style/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="<?=base_url()?>style/bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="<?=base_url()?>style/plugins/iCheck/icheck.min.js"></script>
<script>
$(function () {
	$('input').iCheck({
		checkboxClass: 'icheckbox_square-blue',
		radioClass: 'iradio_square-blue',
		increaseArea: '20%' // optional
	});
	var is_submit = 1;
	$('#submitBtn').on('click',function(){
		var idx = 1;
		if($('#LoginForm input[fld=name]').val() == ''){
			$('#LoginForm input[fld=name]').parent().find('label').html('请输入用户名。');
			idx = 0;
		}else{
			$('#LoginForm input[fld=name]').parent().find('label').html('');
		}
		if($('#LoginForm input[fld=password]').val() == ''){
			$('#LoginForm input[fld=password]').parent().find('label').html('请输入密码。');
			idx = 0;
		}else{
			$('#LoginForm input[fld=password]').parent().find('label').html('');
		}
		if(0 == idx){
			return false;
		}
		if(1 != is_submit){
			return false;
		}
		is_submit = 2;
		$('#LoginForm').submit();
	});
    $('#LoginForm input[name]').on({
        'keypress':function (event){
            var e = window.event||event;
            if(13 == e.keyCode){
                $('#submitBtn').click();
            }
        }
    });
	var error_code = "<?= $error_code?>";
	if(error_code != ''){
		$('#LoginForm input[fld=name]').parent().find('label').html(error_code);
	}
    $('#LoginForm input[fld=name]').focus();
    $('#LoginForm input[fld=name]').select();
});
</script>
</body>
</html>
